package com.i2works.smartluolong.utils.ibeetl;

import com.i2works.smartluolong.utils.base.AppConstant;
import org.beetl.core.GroupTemplate;
import org.beetl.core.Template;
import org.beetl.ext.web.WebRenderExt;
import org.springframework.stereotype.Component;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * @author Liu Yutao <koal@vip.qq.com>
 * @date 2018/2/5 12:17
 */
@Component
public class BeeltCommonExt implements WebRenderExt {

    @Override
    public void modify(Template template, GroupTemplate gt, HttpServletRequest request, HttpServletResponse response) {

        template.binding("timestamp", System.currentTimeMillis());

        template.binding("webUrl", AppConstant.WEB_URL);

        template.binding("webApiUrl", AppConstant.WEB_API_URL);

        template.binding("manageUrl", AppConstant.MANAGE_URL);

        template.binding("manageApiUrl", AppConstant.MANAGE_API_URL);
        
        template.binding("fileStoreUrl", AppConstant.FILE_STORE_URL);


        template.binding("weixinId", AppConstant.WEIXIN_ID);

        template.binding("weixinQRCode", AppConstant.WEIXIN_QRCODE);

        template.binding("weixinQunQrCode", AppConstant.WEIXIN_QUN_QRCODE);

        template.binding("uploaderImageNotpic", AppConstant.UPLOAD_IMAGE_NOTPIC);

        template.binding("uploaderImageAvatar", AppConstant.UPLOAD_IMAGE_AVATAR);

        template.binding("uploaderFilesDomain", AppConstant.UPLOAD_FILES_DOMAIN);

        template.binding("uploaderFilesPath", AppConstant.UPLOAD_FILES_PATH);

        template.binding("uploaderFolderFiles", AppConstant.UPLOAD_FOLDER_FILES);

        template.binding("uploaderFolderImages", AppConstant.UPLOAD_FOLDER_IMAGES);

        template.binding("uploaderFolderIdcard", AppConstant.UPLOAD_FOLDER_IDCARD);

        template.binding("uploaderFolderData", AppConstant.UPLOAD_FOLDER_DATA);
    }
}
